home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJLGR106.ARJ / TEXT.C < prev    next >
C/C++ Source or Header  |  1991-07-21  |  1KB  |  49 lines

  1. /* This is file TEXT.C */
  2. /*
  3. ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  4. **
  5. ** This file is distributed under the terms listed in the document
  6. ** "copying.dj", available from DJ Delorie at the address above.
  7. ** A copy of "copying.dj" should accompany this file; if not, a copy
  8. ** should be available from where this file was obtained.  This file
  9. ** may not be distributed without a verbatim copy of "copying.dj".
  10. **
  11. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  12. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. */
  14.  
  15. #include "sys/registers.h"
  16.  
  17. static unsigned char *font=0;
  18.  
  19. #define CHARHEIGHT 16
  20.  
  21. GrTextXY(int x, int y, char *text, int fg, int bg)
  22. {
  23.   REGISTERS reg;
  24.   unsigned char *fp;
  25.   int r, c, bits;
  26.   if (font == 0)
  27.   {
  28.     reg.ax = 0x1130;
  29.     reg.bx = 0x0600;
  30.     int10(®);
  31.     font = (unsigned char *)reg.bp;
  32.   }
  33.   while (*text)
  34.   {
  35.     fp = font + CHARHEIGHT * *(unsigned char *)text;
  36.     for (r=0; r<CHARHEIGHT; r++)
  37.     {
  38.       bits = *fp++;
  39.       for (c=0; c<8; c++)
  40.         if (bits & (0x80>>c))
  41.           GrPlot(x+c, y+r, fg);
  42.         else
  43.           GrPlot(x+c, y+r, bg);
  44.     }
  45.     text++;
  46.     x += 8;
  47.   }
  48. }
  49.